#!/usr/bin/node

const log=console.log,
      fs=require('fs'),//文件操作需要导入fs模块
      http=require('http'),
pic=process.argv;

let data1=fs.readFileSync(pic[2]);//读取文件数据
let data2=fs.readFileSync(pic[3]);
let data3=fs.readFileSync(pic[4])
let uri1=data1.toString('base64');
let uri2=data2.toString('base64');
let uri3=data3.toString('base64');
//log(`uri:${uri}\n`);
let html=`<html><head><title>data uri</title></head><body><img src="data:image.bmp;base64,${uri1}"><img src="data:image.jpg;base64,${uri2}"><img src="data:image.png;base64,${uri3}"></body></html>`;

http.createServer((req,res)=>{
  res.end(html);
}).listen(8080);
